﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Camc.Quality.Migrations
{
    public partial class add_rexport : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_RbopContents_RbopNodes_RbopNodeId",
                table: "RbopContents");

            migrationBuilder.DropForeignKey(
                name: "FK_RbopNodes_RbopDescs_RbopDescId",
                table: "RbopNodes");

            migrationBuilder.DropIndex(
                name: "IX_RbopNodes_RbopDescId",
                table: "RbopNodes");

            migrationBuilder.DropIndex(
                name: "IX_RbopContents_RbopNodeId",
                table: "RbopContents");

            migrationBuilder.AddColumn<DateTime>(
                name: "ExportDate",
                table: "RbopNodes",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "RelationDate",
                table: "RbopNodes",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "ExportDate",
                table: "RbopNodes");

            migrationBuilder.DropColumn(
                name: "RelationDate",
                table: "RbopNodes");

            migrationBuilder.CreateIndex(
                name: "IX_RbopNodes_RbopDescId",
                table: "RbopNodes",
                column: "RbopDescId");

            migrationBuilder.CreateIndex(
                name: "IX_RbopContents_RbopNodeId",
                table: "RbopContents",
                column: "RbopNodeId",
                unique: true);

            migrationBuilder.AddForeignKey(
                name: "FK_RbopContents_RbopNodes_RbopNodeId",
                table: "RbopContents",
                column: "RbopNodeId",
                principalTable: "RbopNodes",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_RbopNodes_RbopDescs_RbopDescId",
                table: "RbopNodes",
                column: "RbopDescId",
                principalTable: "RbopDescs",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
